package com.xiaobawang.knowledge.spider.scheduler;

import com.xiaobawang.knowledge.spider.service.SchedulerService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class ScheduledTask {

    final SchedulerService schedulerService;

    public ScheduledTask(SchedulerService schedulerService) {
        this.schedulerService = schedulerService;
    }

    /**
     * @author synhard
     * @description 中国人寿每日条款爬取
     * @date 2024/4/9 16:22
     */
//    @Scheduled(cron = "00 00 19 ? * *")
//    public void getChinalifeProductFromWeb() {
//        this.chinalifeProductService.getChinalifeProduct();
//    }

    /**
     * @param
     * @author synhard
     * @description 获取金融监管总局文件
     * @date 2025/6/9 09:23
     */
    @Scheduled(cron = "00 00 12 ? * *")
    public void getGovernmentFinancialFile() {
        // 金融监管总局规章
        this.schedulerService.getGovernmentRulesFromWeb();
        // 金融监管总局行政规范性文件
        this.schedulerService.getGovernmentAdministrationFromWeb();
        // 金融监管总局其他文件
        this.schedulerService.getGovernmentOtherFromWeb();
    }

    /**
     * @param
     * @author synhard
     * @description 获取人民银行官网文件
     * @date 2025/6/18 17:09
     */
    @Scheduled(cron = "00 00 15 ? * *")
    public void getPeopleBankFile() {
        // 人民银行总局规章
        this.schedulerService.getPeopleBankRulesFromWeb();
        // 人民银行总局行政规范性文件
        this.schedulerService.getPeopleAdministrationFromWeb();
    }

}
